package com.site.wisdom_construction.controller.iotModule;

import com.site.wisdom_construction.responseEntity.OneDataResult;
import com.site.wisdom_construction.responseEntity.Page;
import com.site.wisdom_construction.service.iotModule.TowerCraneBasicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Author daiyifei
 * @Date 2022/9/1
 * @Description
 */
@Api(tags = "塔吊基础数据接口")
@RestController
@RequestMapping("TowerCraneBasic")
@CrossOrigin
public class TowerCraneBasicController {
    @Autowired
    private TowerCraneBasicService towerCraneBasicService;

    @ApiOperation(value = "分页模糊查询扬尘监测数据", notes = "必传参数:pageNo,pageSize,projectId")
    @PostMapping("/findTowerCraneBasicByPage")
    public Page findTowerCraneBasicByPage(@RequestBody Map map) {
        Page page = new Page();
        page.setPageNo((Integer) map.get("pageNo"));
        page.setPageSize((Integer) map.get("pageSize"));
        page.setTotal(towerCraneBasicService.Total(map));
        page.setItems(towerCraneBasicService.findTowerCraneBasicByPage(map));
        return page;
    }

    @ApiOperation(value = "根据设备号查询塔机基础信息", notes = "必传参数:projectId")
    @PostMapping("/findTowerCraneBasicByDeviceId")
    public OneDataResult findDustMonitoringByRecently(@RequestBody Map map) {
        OneDataResult oneDataResult = new OneDataResult();
        oneDataResult.setData(towerCraneBasicService.findTowerCraneBasicByDeviceId(map));
        return oneDataResult;
    }

    @ApiOperation(value = "根据项目id查询所有塔机基础信息", notes = "必传参数:projectId")
    @PostMapping("/selectTowerCraneBasic")
    public OneDataResult selectTowerCraneBasic(@RequestBody Map map) {
        OneDataResult oneDataResult = new OneDataResult();
        oneDataResult.setData(towerCraneBasicService.selectTowerCraneBasic(map));
        return oneDataResult;
    }
}
